package com.example.Laboratory.Service.Impl;

import com.example.Laboratory.Entity.Train;
import com.example.Laboratory.Mapper.TrainMapper;
import com.example.Laboratory.Service.TrainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class TrainServiceImpl implements TrainService {

    @Autowired
    TrainMapper trainMapper;

    //增加大创训练成果信息
    @Override
    public String addTrain(Train t) {
        if (trainMapper.addTrain(t) == 1) {
            return "添加成功";
        } else {
            return "添加失败";
        }
    }

    //根据id删除大创训练成果信息
    @Override
    public String deleteTrain(int train_id) {
        if (trainMapper.deleteTrain(train_id) == 1) {
            return "删除成功";
        } else {
            return "删除失败";
        }
    }

    //查找大创训练成果信息
    @Override
    public List<Train> researchTrain() {
        return trainMapper.researchTrain();
    }

    //修改大创训练成果更新
    @Override
    public String reviseTrain(Train t) {
        if (trainMapper.reviseTrain(t) == 1) {
            return "修改成功";
        } else {
            return "修改失败";
        }
    }
}
